﻿@model ECatalog.Models.Shops.ShopViewModel
<div class="container">
    <div class="row col-lg-3">
        @using (Html.BeginForm("Edit", "Shop", null, FormMethod.Post, new { enctype = "multipart/form-data" }))
        {
            @Html.AntiForgeryToken()
            @Html.ValidationSummary(true)

            <fieldset>
                <legend>Редактирование магазина</legend>

                @Html.HiddenFor(model => model.Shop.ShopId)
                @Html.HiddenFor(model=>model.Shop.TypeImage)
                @Html.HiddenFor(model=>model.Shop.MapUrl)
                <div class="editor-label">
                    Название
                </div>
                <div class="editor-field">
                    @Html.TextBoxFor(model => model.Shop.Name, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Shop.Name)
                </div>

                <div class="editor-label">
                    Описание
                </div>
                <div class="editor-field">
                    @Html.TextBoxFor(model => model.Shop.Description, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Shop.Description)
                </div>
                <div class="editor-label">
                    Организация
                </div>
                <div class="editor-field">
                    @Html.DropDownListFor(m => m.Shop.OrganizationId, new SelectList(Model.Organizations, "OrganizationId", "Name"), new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Shop.OrganizationId)
                </div>
                <div class="editor-field">
                    Карта магазина
                </div>
                <div class="editor-field">
                    @{
            var imageUrl = "";
            if (Model != null)
            {
                imageUrl = string.Format("/Files/Organization-{0}/Shop-{1}/{2}/320x240/{3}{4}", @Model.Shop.OrganizationId, @Model.Shop.ShopId, @Model.Shop.MapUrl, @Model.Shop.MapUrl, @Model.Shop.TypeImage);
            }
                    }
                    <img class="photo-block" src="@imageUrl" alt="" />
                    <input type="file" name="UploadedFile" id="UploadedFile" class="form-control" />
                </div>
                <br />
                <p>
                    <input type="submit" value="Сохранить" class="btn btn-primary" />
                </p>
            </fieldset>
        }
        <div>
            @Html.ActionLink("Назад", "Index")
        </div>
    </div>
</div>
